package com.lbhost.baseweb.model;

import com.lbhost.baseweb.constant.ResponseCode;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

/**
 * "@JsonInclude(JsonInclude.Include.NON_NULL)",jackson 实体转json 为NULL的字段不参加序列化（即不显示）
 * @param <T>
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseModel<T> extends BaseResponseModel{


    /**
     * 数据
     */
    private T data;

    public ResponseModel() {
        super(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMessage());
    }

    public ResponseModel(T data) {
        super(ResponseCode.SUCCESS.getCode(), ResponseCode.SUCCESS.getMessage());
        this.data = data;
    }

    public ResponseModel(int code, String message) {
        super(code, message);
    }

    public ResponseModel(T data, int code, String message) {
        super(code, message);
        this.data = data;
    }
}
